package com.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;

// 几个组合注解等于RequestMapping加一个限制条件
// GetMapping只能处理get请求。===@RequestMapping(method = RequestMethod.GET)
@Controller
public class HomeController3 {

    @GetMapping("/get")
    //@RequestMapping(method = RequestMethod.GET)
    public String getMapping() {
        System.out.println(" 只处理get请求--");
        return "index";
    }

    @PostMapping("/post")
    // @RequestMapping(value = "/post",method=RequestMethod.POST)
    public String postMapping() {
        System.out.println(" 只处理post（insert）请求--");
        return "index";
    }

    @DeleteMapping("/delete")
    public String deleteMapping() {
        System.out.println(" delete--");
        return "index";
    }

    @PutMapping("/put")
    public String putMapping() {
        System.out.println(" 修改put--");
        return "index";
    }
}
